<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
</head>
<body>
    <input class="like" type="checkbox">足球
    <input class="like" type="checkbox">篮球
    <input class="like" type="checkbox">排球
    <input class="like" type="checkbox">乒乓球<br>
    <button id="all">全选</button>
    <button id="no">不选</button>
    <button id="reverse">反选</button>
    <script>
        var inputs = $("input");
        $("#all").click(function(){
            for(var i =0;i<inputs.length;i++){
                inputs[i].checked = true;
            }
        })
        $("#no").click(function(){
            for(var i =0;i<inputs.length;i++){
                inputs[i].checked = false;
            }
        })
        $("#reverse").click(function(){
            for(var i =0;i<inputs.length;i++){
                // inputs[i].checked = !inputs[i].checked;
                inputs[i].checked = (inputs[i].checked==true)?false:true;
            }
        })
    </script>
</body>
</html>